Learn R Programming

noia (version 0.94.1)

NOIA matrix manipulation: Matrix algebra in the NOIA framework.

Description

These functions perform the matrix computation required for the computation of genetic effects and Genotype-to-Phenotype mapping.

Usage

gen2Z(gen)
gen2genZ(gen)
genZ2freq(genZ)
genZ2S(genZ=NULL, reference="F2", nloc=NULL, max.level=NULL, 
	max.dom=NULL)
genZ2Z(genZ)
genZ2ZS(genZ, reference="F2", max.level=NULL, max.dom=NULL, 
	threshold=0)
genZ2X(genZ, reference="F2", max.level=NULL, max.dom=NULL)
checkgenZ(genZ, tol=0.0001)
Z2freq(Z)
partialX(genZ, reference="F2", effect)
Sloc(reference="F2", i=NULL, genZ=NULL)
freqmat2Sgenofreqloc(reference="F2", i=NULL, freqmat=NULL, sinv=TRUE)
freqmat2Sgenofreq(nloc, reference="F2", freqmat=NULL, sinv=TRUE)

Arguments

gen
The matrix of genotypes, one column per locus, the genotype is coded 1, 2, 3. Missing data are allowed.
genZ
The matrix of genotypic probabilities, 3 columns per locus (one for the probability of each genotype). The sum of probabilities must be 1, and missing data are not allowed.
reference
The reference of the population. "F2", "F1", "Finf". "P1", "P2", "G2A", "UWR" and "noia" are possible. Default is "F2".
nloc
Number of loci.
max.level
Maximum level of interactions.
max.dom
Maximum level for dominance effects.
threshold
Frequency threshold from which a genotype is taken into account. Values other than 0 might bias the results.
Z
A matrix reflecting the genotype of the corresponding observed phenotypes, as defined in Alvarez-Castro and Carlborg 2007.
tol
A tolerance factor, featuring how much the sum of genotypic frequencies can be different from 1.
effect
The name of a genetic effect (such as ".ad").
i
Index of the locus.
freqmat
For reference="G2A": A vector of length nloc containing allele frequencies such that freqmat[i]=frequency(allele 1) for locus i. For referenc
sinv
Boolean flag indicating whether inv(S) should be returned in addition to S

Details

gen2Z: Transforms a gen data set into a Z matrix that is the data matrix in the regression. The function actually calls sequencially gen2genZ and genZ2Z. gen2genZ: Transforms a gen matrix into a genZ matrix.

genZ2freq: Provides a vector representing the frequency of each genotypic form at each locus. The sum of the frequency is 1 for each locus.

genZ2S: Provides the S matrix (see Alvarez-Castro and Carlborg 2007) for a given reference point. Some reference points are genotypic frequency-dependent ("G2A" and "noia"), and the genZ matrix must be provided. For the others, only the number of loci is necessary.

genZ2Z: Computes the Z matrix from the genotypic probabilities. See Alvarez-Castro and Carlborg 2007 for more details.

genZ2ZS: Computes Z and S matrices at the same time. This is highly efficient when many genotypes are not represented in the dataset. The function returns a list of two elements "zmat" and "smat".

genZ2X: Computes the product of Z and S matrices without building them. This is very efficient when considering only low-level interactions.

checkgenZ: Checks the structure of the genZ matrix.

Z2freq: Computes the multi-locus genotypic frequency over all genotypic combinations.

partialX: Computes the product of Z and S matrices, keeping Z and S as small as possible considering a given effect effect.

Sloc: Provides a 3x3 S matrix, corresponding to one locus. Frequency-dependent reference points will require the genZ matrix and the index of the locus.

freqmat2Sgenofreqloc: Returns the 3x3 S matrix (and inv(S) if sinv=TRUE) for given i, freqmat and reference.

freqmat2Sgenofreq: Returns the 3^nloc x 3^nloc S matrix (and inv(S) if sinv=TRUE) for given freqmat and reference.

References

Alvarez-Castro JM, Carlborg O. (2007). A unified model for functional and statistical epistasis and its application in quantitative trait loci analysis. Genetics 176(2):1151-1167. Le Rouzic A, Alvarez-Castro JM. (2008). Estimation of genetic effects and genotype-phenotype maps. Evolutionary Bioinformatics, 4.

See Also

linearRegression, multilinearRegression, linearGPmapanalysis

Examples

Run this code
set.seed(123456789)

map <- c(0.25, -0.75, -0.75, -0.75, 2.25, 2.25, -0.75, 2.25, 2.25)
names(map) <- genNames(2)
pop <- simulatePop(map, N=500, sigmaE=0.2, type="F2")

gen <- pop[2:3]
genZ <- gen2genZ(gen)
Z <- genZ2Z(genZ)

Run the code above in your browser using DataLab